home *** CD-ROM | disk | FTP | other *** search
- *******************************************************************************
- * PT_Sample
- * ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
- * Plays a digital sound sample though a specified sound channel with frequency
- * and volume. Its checks if the ProTracker replayer is playing and disables
- * the sound channel..plays sample, then re-enables the channel with old params.
- *
- * INPUTS ; a1=Pt to Sample Structure;
- * ; d3=Channel to use.
- * e.g;
- * SampleStruct dc.l Sample,Sampend-Sample ;sample pt, sample length
- * dc.w $40,400 ;volume, frequency
- * ...
- *
- * OUTPUTS; None.. Sample will be stopped using sample interrupt (lev6 access)
- *******************************************************************************
-
- include includes:misc/_hardware.i
-
- lea samplestruct(pc),a1
- moveq #0,d3
- bsr pt_sample
- rts
-
- PT_Sample: move.l (a1)+,a0 ;sample ptr
- move.l (a1)+,d0 ;sample length
- move.w (a1)+,d1 ;volume
- move.w (a1)+,d2 ;frequency
-
- lea $dff000.l,a5 ;hardware base in a5
- lsr.w #1,d0 ;get correct length
-
- move.w #$780,d4 ;audio 0 intena
- move.w #$800f,d5 ;audio 0 channel dma
-
- lea Aud0lch(a5),a6 ;audio 0 ptr
- move.w #7,d6 ;audio 0 intreqr finished
- tst.b d3
- beq.s PlaySamp
-
- lea Aud1lch(a5),a6 ;audio 1 ptr
- move.w #8,d6 ;audio 1 intreqr finished
- cmp.b #1,d3
- beq.s PlaySamp
-
- lea Aud2lch(a5),a6 ;audio 2 ptr
- move.w #9,d6 ;audio 2 intreqr finished
- cmp.b #2,d3
- beq.s PlaySamp
-
- lea Aud3lch(a5),a6 ;audio 3 ptr
- move.w #10,d6 ;audio 3 intreqr finished
-
- PlaySamp: move.l a0,(a6)+ ;sample ptr
- move.w d0,(a6)+ ;length of sample
- move.w d2,(a6)+ ;Use Frequency
- move.w d1,(a6) ;Volume
-
- move.w d4,IntReq(a5) ;set intreq
- move.w d5,dmacon(a5) ;sound dma on for channel
-
- moveq #2-1,d1 ;2 tests
- IWait1 move.w $1e(a5),d0 ;intreqr
- btst d6,d0 ;signalled yet?
- beq.s IWait1 ;no, keep loopin`
- move.w d4,IntReq(a5) ;set intreq
- move.w d5,dmacon(a5) ;sound dma on for channel
- dbf d1,IWait1 ;keepon
-
- clr.w (a6) ;clear sound volume
- rts
-
- samplestruct dc.l sample,sampleend-sample
- dc.w $40,400
-
- sample incbin 'comms:done.raw'
- sampleend even
-